package kolekcje.powtorka;

public class TestGenericsOne {

	private class Cat extends Animal {
		@SuppressWarnings("unused")
		void meow() {
			System.out.println("meow");
		}
	}

	private class Dog extends Animal {
		@SuppressWarnings("unused")
		void bark() {
			System.out.println("wow wow");
		}
	}

	private abstract class Animal {
		void eat() {
			System.out.println("animal eating");
		}
	}

	public static void main(String[] args) {

		new TestGenericsOne().go();
	}

	private void go() {
		Animal[] animals = { new Dog(), new Cat(), new Dog() };
		Dog[] dogs = { new Dog(), new Dog(), new Dog() };
		takeAnimals(animals);
		System.out.println();
		takeAnimals(dogs);
	}

	private void takeAnimals(Animal[] animals) {
		for (Animal a : animals)
			a.eat();
		animals[0] = new Cat();
	}

}
